package servicempl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import dao.StudentMapper;
import pojo.Student;
import service.Studentservice;
import untils.Page;
@Service
public class Studentservicempl implements Studentservice {
	@Resource
	private StudentMapper studentmapper;


	public StudentMapper getStudentmapper() {
		return studentmapper;
	}

	public void setStudentmapper(StudentMapper studentmapper) {
		this.studentmapper = studentmapper;
	}

	@Override
	public void increase(Student student) {
		studentmapper.increase(student);
	}

	@Override
	public void delete(int id) {
		studentmapper.delete(id);
	}

	@Override
	public Student update(Student student) {
		return studentmapper.update(student);
	}

	@Override
	public Student find(int id) {
		Student student=studentmapper.find(id);
		return student;
	}
	
	
	public Student findname(String name,String grade,String major) {
		
		
		return null;
	}
	
	// 学生信息列表
		public Page<Student> findstudentList(int page,int rows,String name,String grade,String major) {
			// 创建学生对象
	         Student student = new Student();
			// 判断客户名称
			if(name!=null){
				student.setName(name);
			}
			// 判断客户信息来源
			if(grade!=null){
				student.setGrade(grade);
			}
			// 判断客户所属行业
			if(major!=null){
				student.setMajor(major);
			}
			student.setStart((page-1) * rows) ;
			// 每页数
			student.setRows(rows);
			// 查询客户列表
			List<Student> students = studentmapper.findstudentList(student);
			// 查询客户列表总记录数
			Integer count = studentmapper.studentcount(student);
			// 创建Page返回对象
			Page<Student> result = new Page<>();
			result.setPage(page);
			result.setRows(students);
			result.setSize(rows);
			result.setTotal(count);
			return result;
		}
		
		//增加论文信息
		public void increasepapernum(int studentID) {
		 studentmapper.increasepapernum(studentID); 
		}

}
